/*
提交链接:https://leetcode.cn/problems/partition-array-into-disjoint-intervals/description/
915. 分割数组
赖德檀 2024/12/19
*/

class Solution {
public:
    int partitionDisjoint(vector<int>& nums) {
        int l=nums[0],r=nums[0],k=0;
        for(int i=0;i<nums.size();i++)
        {
            if(nums[i]<l)
            {
                k=i;
                l=r;
            }
            r=max(r,nums[i]);
        }
        return k+1;
    }
};